package com.work.cos.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.work.cos.domain.entity.VerCodeLogEntity;
import com.work.cos.service.interfc.ISendSMSService;
import com.work.cos.service.interfc.IVerCodeLogService;
import com.work.cos.util.SMSUtils;

@Service
public class SendSMSServiceImpl implements ISendSMSService{

	@Autowired
	private IVerCodeLogService codeLogService;
	
	@Override
	public boolean sendVerCodeByPhone(Long phone) {
		Map<String,Object> resultMap = SMSUtils.sendMessage(phone.toString());
		if(null != resultMap && "0".equals(resultMap.get("resultcode").toString())){
			VerCodeLogEntity verCodeLogInfo = new VerCodeLogEntity();
			verCodeLogInfo.setPhone(phone);
			verCodeLogInfo.setContent(resultMap.get("content").toString());
			verCodeLogInfo.setVerCode(resultMap.get("verCode").toString());
			return codeLogService.addVerCodeLog(verCodeLogInfo);
		}
		return false;
	}

	@Override
	public String findMobileMessage(Map<String, Object> pars) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int getMobileMessageCount(Map<String, Object> pars) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public boolean getMobileMessageStatus(Map<String, Object> pars) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean getMemberMobileIsExist(Long phone) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Map<String, Object> sendVerCode(Long phone) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Map<String, Object> sendAioMessage(String mobile, String content) {
		// TODO Auto-generated method stub
		return null;
	}

}
